package com.itheima.mapper;

import com.itheima.domain.pojo.Clazz;
import com.itheima.domain.query.ClazzQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @author: Sch
 * @Date: 2025/07/10 18:19
 * @Description:
 */
@Mapper
public interface ClazzMapper {

    // 添加
    @Insert("insert into clazz (name,room,begin_date,end_date,master_id,subject,create_time,update_time) values (#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void insert(Clazz clazz);

    // 查询
    @Select("select id,name,room,begin_date,end_date,master_id,subject,create_time,update_time from clazz where id = #{id}")
    Clazz getById(Integer id);

    // 查询所有
    @Select("select * from clazz")
    List<Clazz> findAll();

    // 分页查询
    List<Clazz> list(ClazzQueryParam clazzQueryParam);


    @Delete("delete from clazz where id =#{id} ")
    void deleteById(Integer id);

    @Update("update clazz set name = #{name},room = #{room},begin_date = #{beginDate},end_date = #{endDate},master_id = #{masterId},subject = #{subject} where id = #{id}")
    void update(Clazz clazz);


    int findStudentCountByClazzId(Integer clazzId);




}

